package first.endtoend

class Product
{

    String name;
    String unity;

    String iconURL;
    String description;

    float pricePerUnit //same price fixed by state for all fairPricesShop

    Date dateCreated
    Date lastUpdated

    static hasMany = [details: TraceDetail]
    static belongsTo = [tag: Tag]
    static constraints = {
        name(unique: true, nullable: false, blank: false)
        description(nullable: true, blank: true)
        unity(nullable: true, blank: false, inList: ['Kg', 'Lbl', 'L', 'G'])
        pricePerUnit(nullable: true, blank: false)
        tag(nullable: true)
        iconURL(nullable: true)
        details nullable: true

    }

    @Override
    public String toString()
    {
        return name;
    }
}
